package cn.codingstyle.product;

import cn.codingstyle.promotion.Promotion;
import lombok.Builder;
import lombok.Getter;
import lombok.ToString;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Builder
@Getter
@ToString
public class Product {
    private int id;
    private String barcode;
    private String name;
    private String unit;
    private BigDecimal price;
    private String type;
    private List<Promotion> promotions = new ArrayList<>();

    public void addPromotion(Promotion promotion) {
        this.promotions.add(promotion);
    }

    public void addPromotions(List<Promotion> promotions) {
        this.promotions = promotions;
    }
}
